package com.jxl.dnd.charactercreator.vo.races
{
	import flash.events.EventDispatcher;

	[Bindable]
	public class Race extends EventDispatcher
	{
		public static const DRAGON_BORN:String			= "Dragon Born";
		public static const DWARF:String				= "Dwarf";
		public static const ELADRIN:String				= "Eladrin";
		public static const ELF:String					= "Elf";
		public static const HALF_ELF:String				= "Half-Elf";
		public static const HALFLING:String				= "Halfling";
		public static const HUMAN:String				= "Human";
		public static const TIEFLING:String				= "Tiefling";
		
		
		public var name:String;
		
		public function Race(name:String="Human"):void
		{
			super();
			
			this.name			= name;
		}
		
		public function buildFromObject(obj:Object):void
		{
			this.name				= obj.name;
		}
		
		public function toObject():Object
		{
			var obj:Object = new Object();
			obj.name			= name;
			return obj;
		}
		
		public function toXML():XML
		{
			var myXML:XML = 
				<race>
					<name>{name}</name>
				</race>;
			return myXML;
		}
		
		public function buildFromXML(xml:XML):void
		{
			for each(var raceNode:XML in xml..race)
			{
				name = raceNode.name;
			}
		}
		
	}
}